package com.atguigu.srb.core.controller.admin;


import com.atguigu.common.result.R;
import com.atguigu.srb.core.pojo.entity.BorrowInfo;
import com.atguigu.srb.core.pojo.vo.BorrowInfoApprovalVO;
import com.atguigu.srb.core.service.BorrowInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 借款信息表 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-09-13
 */
@RestController
@RequestMapping("/admin/core/borrowInfo")
public class AdminBorrowInfoController {

    @Resource
    BorrowInfoService borrowInfoService;

    @GetMapping("/getList")
    public R getList(){
       List<BorrowInfo> list = borrowInfoService.getList();
        return R.ok().data("list",list);
    }
    @GetMapping("/show/{id}")
    public R showBorrowInfo(@PathVariable Long id){
      Map<String,Object> borrowInfoDetail = borrowInfoService.showBorrowInfo(id);
        return R.ok().data("borrowInfoDetail",borrowInfoDetail);
    }
    @PostMapping("/approvalSubmit")
    public R approvalSubmit(@RequestBody BorrowInfoApprovalVO borrowInfoApprovalVO){
        borrowInfoService.approvalSubmit(borrowInfoApprovalVO);
        return R.ok();
    }

}

